//
//  HotCollectionViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HotCViewcell.h"

@implementation HotCViewcell
//初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //图片
        self.imageView = [[UIImageView alloc] init];

        [self.contentView addSubview:self.imageView];
        //标题
        self.titleLable = [[UILabel alloc] init];

        [self.contentView addSubview:self.titleLable];
        
        self.intrLabel = [[UILabel alloc] init];

        [self.contentView addSubview:self.intrLabel];
        
//        self.playButton = [[UIButton alloc] init];

//        [self.contentView addSubview:self.playButton];

    }
    return self;
}

//布局方法
-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    [super applyLayoutAttributes:layoutAttributes];
    self.imageView.frame = CGRectMake(0, 0, layoutAttributes.size.width, layoutAttributes.size.height - 40);
    
    self.titleLable.frame = CGRectMake(0, self.imageView.frame.size.height, self.imageView.frame.size.width, 20);
    self.titleLable.textAlignment = YES;
    
    self.intrLabel.frame = CGRectMake(0, self.imageView.frame.size.height + 20, self.imageView.frame.size.width, 20);
    self.intrLabel.font = [UIFont systemFontOfSize:14];
    self.intrLabel.textAlignment = YES;
    self.playButton.frame = CGRectMake(self.imageView.frame.origin.x + 85, self.imageView.frame.origin.y + 75, 20, 20);
    [self.playButton setBackgroundImage:[UIImage imageNamed:@"播放"] forState:UIControlStateNormal];
    [self.playButton setTintColor:[UIColor whiteColor]];

    
    
}
- (void)setNewCellModel:(MusicSmallModel *)NewCellModel
{
    _NewCellModel = NewCellModel;
    self.intrLabel.text = [NSString stringWithFormat:@"%@",_NewCellModel.name];
    self.titleLable.text = [NSString stringWithFormat:@"%@",_NewCellModel.desc];
    NSURL *url = [NSURL URLWithString:_NewCellModel.picUrl];
    [self.imageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"hold.png"]];
}


@end
